
/*
*******************************************************************************************************************************************************
* Program Purpose: 
- starts with the business panel of 5 survey waves and newly generated variables
- collapses business outcomes at the household level
- prepares for analysis

*******************************************************************************************************************************************************
*/
	
*******************************************************************************************************************************************************
*
*
*USING FILE
*
*
*******************************************************************************************************************************************************
	

	*in some regressions, we want to start from collapsing at the client level
	local client : list sizeof global(clientlevel)
	if ( `client'==0) {
		use "$data_final/Panel Business Level with Variables.dta", clear
	}	

*******************************************************************************************************************************************************
*
*
*STEP 1:COLLAPSING- SO WE HAVE 1 OBS PER HOUSEHOLD
*
*
*******************************************************************************************************************************************************

	************************************
	**SAVING LABELS
	************************************	
	 foreach v of var * {
 	local l`v' : variable label `v'
       if `"`l`v''"' == "" {
 		local l`v' "`v'"
			}
		}
 
			
	************************************
	**MAX/SUM/MEAN AT HOUSEHOLD LEVEL
	************************************		
	collapse (max)  Attriter Group_Size digitspan_1 Public ///
	Revealed Incentives  survey_month Surveyor_Code   Income Winner* ///
	Gender_Followup  Education_Followup Age_Followup Married_Followup HH_Size_Followup  ///
	B_* ///
	TV_hhincome_1 TV_Medical_1 TV_Medical_2 TV_Medical_3 TV_Medical_4 TV_Medical_5 ///
	TV_Medical_6 TV_hardwork_1 TV_hardwork_2 ///
	TV_marginal1 TV_marginal2 hhroster_21 /// 
	New_Business Total_Assets	///
	miss_B* miss_*Followup ///
	client_bus_sector_det client_bus_sector_broad ///
		(sum)  Labor_5 Labor_10 Total_Business_Assets   ///
	Inventory NonHH_Labor NonHH_Labor_Dummy NonHH_Labor_Hrs  HH_Labor /// 
	HH_Labor_Dummy HH_Labor_Hrs Avg_Yrly_Profits Profits_30Days  ///
	Owner_Hours_Week Owner_Days_Month ///
	Client_Hours_Week Client_Days_Month ///	
	Client_Profits_30Days  ///
		(mean)miss_Profits_30Days miss_Client_Profits_30Days miss_Income ///
	miss_Inventory miss_Total_Business_Assets miss_Owner_Hours_Week ///
	miss_Owner_Days_Month  miss_HH_Labor miss_HH_Labor_Hrs miss_Labor_5 miss_NonHH_Labor ///
	miss_NonHH_Labor_Hrs miss_Labor_10 miss_NonHH_Labor_Dummy miss_HH_Labor_Dummy ///
	,by(Id Survey_Version GroupNumber) 

	************************************
	**MPUTTING LABELS BACK
	************************************		 		
	 foreach v of var * {
		label var `v' `"`l`v''"'
		}
***************************************************************************************************************
*SETTING THE DATE AND SURVEY VERSION TO CREATE PANEL
***************************************************************************************************************

	tsset Id Survey_Version
***************************************************************************************************************
*
*
*STEP 2: VARIABLE CREATION
*
*
***************************************************************************************************************
	***************************************************************************************************************
	*WILL ONLY RUN REGRESSIONS FOR NON-ATTRITERS
	***************************************************************************************************************
	gen Done=Attriter==0
			
	***************************************************************************************************************
	*KEEPING ONLY THE FIRST 4 WAVES OF DATA
	***************************************************************************************************************
	*if otherwise specified, the data keeps all 5 rounds
	local round5 : list sizeof global(wave5)
	display "`round5'"
	if ( `round5'==0) {
		drop if Survey_Version==5
	}
	 

	***************************************************************************************************************
	*RECODING PROFITS/INCOME VARIABLE FROM BASELINE IF PROFITS/INCOME ARE MISSING FOR A ROUND
	***************************************************************************************************************
	*All profits obersvations for the household is missing for survey round x
	foreach var in Profits_30Days Income Client_Profits_30Days  ///
		Inventory Total_Business_Assets Owner_Hours_Week Owner_Days_Month ///
		HH_Labor HH_Labor_Hrs Labor_5 NonHH_Labor ///
		NonHH_Labor_Hrs Labor_10 NonHH_Labor_Dummy HH_Labor_Dummy {
		sum `var'
		recode `var' (0=.) if miss_`var'==1
		}


	***************************************************************************************************************
	*WINSORIZING TOP 0.5% PROFITS AND INCOME
	***************************************************************************************************************
	
	*Winsorizing top 0.5% (replacing the value of top 0.5% observations with the value of the 99.5th percentile)
	egen Capital=rowtotal(Inventory Total_Business_Assets),m
	
	foreach var of varlist Income Profits_30Days Total_Business_Assets Inventory Capital NonHH_Labor NonHH_Labor_Dummy ///
	NonHH_Labor_Hrs HH_Labor HH_Labor_Dummy HH_Labor_Hrs Labor_5 Labor_10 Owner_Hours_Week ///
	Owner_Days_Month Client_Hours_Week Client_Days_Month ///
	Client_Profits_30Days Avg_Yrly_Profits {
		*generating winsorized value 
		gen wins_`var'=`var'
		_pctile `var', p(99.5)
		replace  wins_`var'=r(r1) if `var'>r(r1) & `var'!=.
		*generating baseline value 
		tempvar temp
			gen `temp'=wins_`var' if Survey_Version==1
			bys Id: egen wins_B_`var'=max(`temp')	
	}
	
	
	***************************************************************************************************************
	*CREATING PROFITS TRIMS
	***************************************************************************************************************
	gen perchange_profits=100*(Profits_30Days-L.Profits_30Days)/L.Profits_30Days

	*cuts off top 0.5% 
	egen xtreme_high=pctile(perchange_profits), p(99.5)
	egen xtreme_low=pctile(perchange_profits), p(1)
	
	gen sample=1 if perchange==.|  (perchange_profits <=xtreme_high ) 
	
	***************************************************************************************************************
	*TRIMMING ALL OUTCOME VARIABLES AND CREATING BASELINE VERSIONS OF DYNAMIC VARIABLES 
	***************************************************************************************************************
	
	*egen Capital=rowtotal(Inventory Total_Business_Assets),m
		
	foreach var in  Total_Business_Assets Inventory Capital NonHH_Labor NonHH_Labor_Dummy ///
	NonHH_Labor_Hrs HH_Labor HH_Labor_Dummy HH_Labor_Hrs Labor_5 Labor_10 Owner_Hours_Week ///
	Owner_Days_Month Client_Hours_Week Client_Days_Month ///
	Client_Profits_30Days ///
	Profits_30Days Income Avg_Yrly_Profits{
		*trimming
		gen Trim_`var'=`var' if sample==1
		*generating baseline value 
		tempvar temp
			gen `temp'=Trim_`var' if Survey_Version==1
			bys Id: egen B_`var'=max(`temp')	
	}
	
	*generating the log variables
	gen log_Income=log(Income+1)
	gen log_Profits=log(Profits_30Days+1)
	gen IHS_Profits=asinh(Profits_30Days) 
	gen IHS_Income=asinh(Income)
	
	g B_Trim_Income=B_Income
	g B_Trim_Profits_30Days=B_Profits

	foreach var in log_Profits log_Income IHS_Profits IHS_Income{
		*generating baseline value 
		tempvar temp
			gen `temp'=`var' if Survey_Version==1
			bys Id: egen B_`var'=max(`temp')		
	}
	
***************************************************************************************************************
*HUSEHOLD LEVEL GRANT EXPENDITURES
***************************************************************************************************************
	sort Id
	merge m:1 Id  using  "$data_raw\survey rounds\Grant Expenditures.dta", update
	tab _merge
	drop _merge
		

	recode grant* (-999=.)
	
	egen Household_Expenditures=rowtotal(grant7 grant8 grant9),m
	
	egen Business_Expenditures=rowtotal(grant3 grant4 grant5 grant6 ),m


*******************************************************************************************************************************************************
*MERGINING IN AVERAGE RANK FROM BASELINE
*******************************************************************************************************************************************************
			
	
	sort Id
	preserve
		use "$data_raw\rankings data\Rankings Individual.dta", clear
		drop if q==.
		keep if q==1 | q==2
		gen Self_Rank_MR=AllRank if Id==RespondentID
		gen AllRank_NS=AllRank if AllRank!=.d
			replace AllRank_NS=. if Id==RespondentID
		

		*median rank
		gen AllRank_med=AllRank
		
		*standard deviation
		gen AllRank_sd=AllRank_NS
		
			
		collapse (sd) AllRank_sd (median) AllRank_med (mean) AllRank AllRank_NS Self_Rank_MR , by (Id q)
		reshape wide AllRank AllRank_NS Self_Rank_MR AllRank_med AllRank_sd, i(Id) j(q)
		keep  AllRank1 AllRank2  AllRank_NS1 AllRank_NS2 Self_Rank_MR1 Self_Rank_MR2  AllRank_med1 AllRank_med2 AllRank_sd1 AllRank_sd2 Id
		
		rename AllRank_NS1 AllRank1_NS
		rename AllRank_NS2 AllRank2_NS
		rename AllRank_med1 AllRank1_med_NS
		rename AllRank_med2 AllRank2_med_NS
		rename AllRank_sd1 AllRank1_sd_NS
		rename AllRank_sd2 AllRank2_sd_NS
		
		sort Id
		set seed 12345678
			gen random_number=runiform()
		sort AllRank1 Id
		*percentile with self rank
		cumul AllRank1, gen (Quintile_Rank_Pct)
	
		*sort AllRank1_NS Id
		sort AllRank1_NS random_number
		*percentile of rank without self
		cumul AllRank1_NS , gen (Quintile_Rank_NS_Pct)
		
		sort AllRank1_med_NS Id
		*percentile of median rank without self
		cumul AllRank1_med_NS , gen (Quintile_Rank_med_NS_Pct)

	
		sort Id
		tempfile temporary
		save `temporary'
	restore
	merge Id using  `temporary'
	tab _merge
	drop _merge

********************************************************************************************************************************************************
*MERGING IN THE TOTAL NUMBER OF TICKETS WON
*Making propensity score
*******************************************************************************************************************************************************
	sort Id
	merge m:1 Id  using  "$data_raw\randomization and tracking\treatments and master trackers.dta", update
	tab _merge
	drop _merge
		
	bys GroupNumber Survey_Version:egen Number_Grants_Group=sum(Winner2)
	*everyone got at least 20 tickets - 
	replace Total_Num_Tickets= Total_Num_Tickets+20 if Total_Num_Tickets!=.

	
	bys GroupNumber Survey_Version: egen Total_Tix_Group=sum(Total_Num_Tickets)
	gen Prob_Winning_OneGrant=Total_Num_Tickets/Total_Tix_Group if Number_Grants_Group==1
	sum Total_Num_Tickets,detail
	gen Prob_Winning_TwoGrant=(Total_Num_Tickets/Total_Tix_Group)+(1-Total_Num_Tickets/Total_Tix_Group)*(Total_Num_Tickets/(Total_Tix_Group-r(mean))) if  Number_Grants_Group==2
	gen Prob_Winning=Prob_Winning_OneGrant
		replace Prob_Winning=Prob_Winning_TwoGrant if Prob_Winning_OneGrant==.
	
	*In the paper, we refer to this variable below as the inverse propensity score (which is what it is - the inverse of the probability of winning the grant)
	gen Propensity_Score=.
		replace Propensity_Score=1/Prob_Winning if Winner2==1 
		replace Propensity_Score=1/(1-Prob_Winning) if Winner2==0 

	
*******************************************************************************************************************************************************
*INTERACTIONS WITH WINNER
*******************************************************************************************************************************************************
	***************
	*INTERACTING WINNER WITH RANK- QUINTILE
	***************	
	rename AllRank1 Quintile_Rank
	gen Winner_Quintile_Rank=Winner*Quintile_Rank	
	

	tempvar rank_tercile
		egen `rank_tercile'=cut(Quintile_Rank), group(3)
		tab `rank_tercile', gen(Quintile_Rank_Tercile_)
		gen Winner_Quintile_Rank_Tercile_2= Winner*Quintile_Rank_Tercile_2
		gen Winner_Quintile_Rank_Tercile_3= Winner*Quintile_Rank_Tercile_3
		gen Winner_Quintile_Rank_Tercile_1= Winner*Quintile_Rank_Tercile_1
		
	***************
	*INTERACTING WINNER WITH RANK- QUINTILE - NO SELF RANK
	***************	
	rename AllRank1_NS Quint_Rank_NS
	gen Winner_Quint_Rank_NS=Winner*Quint_Rank_NS	
	
	*cumul Quint_Rank_NS, gen (Quint_Rank_NS_Pct)
	
	tempvar rank_tercile
		egen `rank_tercile'=cut(Quint_Rank_NS), group(3)
		tab `rank_tercile', gen(Quint_Rank_NS_Tercile_)
		gen Winner_Quint_Rank_NS_Tercile_2= Winner*Quint_Rank_NS_Tercile_2
		gen Winner_Quint_Rank_NS_Tercile_3= Winner*Quint_Rank_NS_Tercile_3
		gen Winner_Quint_Rank_NS_Tercile_1= Winner*Quint_Rank_NS_Tercile_1

	***************
	*INTERACTING WINNER WITH MEDIAN RANK- QUINTILE - NO SELF RANK
	***************	
	rename AllRank1_med_NS Q_Rank_med_NS
	gen Winner_Q_Rank_med_NS=Winner*Q_Rank_med_NS	
	
	
	tempvar rank_tercile
		egen `rank_tercile'=cut(Q_Rank_med_NS), group(3)
		tab `rank_tercile', gen(Q_Rank_med_NS_Tercile_)
		gen Winner_Q_Rank_med_NS_Tercile_2= Winner*Q_Rank_med_NS_Tercile_2
		gen Winner_Q_Rank_med_NS_Tercile_3= Winner*Q_Rank_med_NS_Tercile_3
		
	***************
	*INTERACTING WINNER WITH SD RANK- QUINTILE - NO SELF RANK
	***************	
	rename AllRank1_sd_NS Quint_Rank_sd_NS
	gen Winner_Quint_Rank_sd_NS=Winner*Quint_Rank_sd_NS	
	gen Winner_SD_Rank=Winner*Quint_Rank_sd_NS*Quint_Rank_NS
	
	gen Winner_T1_sd_NS= Winner_Quintile_Rank_Tercile_1*Winner_SD_Rank
	gen Winner_T2_sd_NS= Winner_Quintile_Rank_Tercile_2*Winner_SD_Rank
	gen Winner_T3_sd_NS= Winner_Quintile_Rank_Tercile_3*Winner_SD_Rank

	***************
	*INTERACTING WINNER WITH RANK- QUINTILE - NO SELF RANK
	***************	
	rename AllRank2_NS Rel_Rank_NS
	gen Winner_Rel_Rank_NS=Winner*Rel_Rank_NS	
	
	tempvar rank_tercile
		egen `rank_tercile'=cut(Rel_Rank_NS), group(3)
		tab `rank_tercile', gen(Rel_Rank_NS_Tercile_)
		gen Winner_Rel_Rank_NS_Tercile_2= Winner*Rel_Rank_NS_Tercile_2
		gen Winner_Rel_Rank_NS_Tercile_3= Winner*Rel_Rank_NS_Tercile_3
		
	***************
	*INTERACTING WINNER WITH RANK- RELATIVE
	***************	
	rename AllRank2 Relative_Rank
	gen Winner_Relative_Rank=Winner*Relative_Rank

	tempvar rank_tercile
		egen `rank_tercile'=cut(Relative_Rank), group(3)
		tab `rank_tercile', gen(Relative_Rank_Tercile_)
		gen Winner_Relative_Rank_Tercile_2= Winner*Relative_Rank_Tercile_2
		gen Winner_Relative_Rank_Tercile_3= Winner*Relative_Rank_Tercile_3
		
	***************
	*INTERACTING SURVEY VERSION WITH RANK
	***************	
	tab Survey_Version, gen(Survey_Version_)
	forvalues i=1/4{
		gen Quintile_Rank_Survey_Version_`i'=Quintile_Rank*Survey_Version_`i'
		}
		
	***************
	*INTERACTING WINNER WITH BASELINE CHARACTERSITICS
	***************	

	foreach  var of varlist Gender_Followup Education_Followup Age_Followup Married_Followup  HH_Size_Followup B_*{
		gen Winner_`var'=Winner*`var'
		}
		
**************************************************************************************************************************************
*FIXED EFFECTS
*******************************************************************************************************************************************************
		
	tab Surveyor_Code, gen(Surveyor_Code)
	tab Survey_Version, gen(Survey_Version)
	tab survey_month, gen(survey_month)


********************************************************************************************************************************************************
*LABELING
*******************************************************************************************************************************************************
	*************************************************	
	*Outcome Variables
	*************************************************	
	*profits and income
	label var Profits_30Days "Profits"
	label var Income "Income"
	label var log_Profits "\specialcell{Log \\ Profits}"
	label var log_Income "\specialcell{Log \\ Income}"
	label var IHS_Profits "\specialcell{IHS \\ Profits}"
	label var IHS_Income "\specialcell{IHS \\ Income}"
	label var Trim_Profits "\specialcell{Profits}"
	label var Trim_Income "\specialcell{Income}"
	label var wins_Profits_30Days "\specialcell{Winsorized \\ Profits}"
	label var wins_Income "\specialcell{Winsorized \\ Income}"
	
	*business inputs
	label var Trim_Total_Business_Assets "\specialcell{Durable \\Business \\ Assets}"
	label var Trim_Inventory "\specialcell{Business \\ Inventory}"
	label var Trim_Capital "\specialcell{Total \\ Capital}"
	label var Trim_Owner_Hours_Week "\specialcell{Total \\ Hours \\ Worked \\ Past Week}"
	label var Trim_Owner_Days_Month "\specialcell{Total \\ Days \\ Worked \\ Past Month}"
	label var Trim_HH_Labor "\specialcell{Total \\ HH \\ Labor}" 
	label var Trim_HH_Labor_Dummy "\specialcell{Uses \\ Household\\ Labor}"
	label var Trim_HH_Labor_Hrs "\specialcell{ Household\\ Labor \\ Hours \\ Past Week}"
	label var Trim_Labor_5 "\specialcell{ HH\\ Labor \\ Wage Bill \\ Past Week}"
	label var Trim_NonHH_Labor "\specialcell{Total \\ Non-HH \\ Labor}" 
	label var Trim_NonHH_Labor_Dummy "\specialcell{Uses \\ Non-HH \\ Labor}" 
	label var Trim_NonHH_Labor_Hrs "\specialcell{ HH \\ Labor \\ Hours \\ Past Week}"
	label var Trim_Labor_10 "\specialcell{ Non-HH\\ Labor \\ Wage Bill \\ Past Week}"


	*business inputs - winsorized
	label var wins_Total_Business_Assets "\specialcell{Wins Durable \\Business \\ Assets}"
	label var wins_Inventory "\specialcell{Wins Business \\ Inventory}"
	label var wins_Capital "\specialcell{Wins Total \\ Capital}"
	label var wins_Owner_Hours_Week "\specialcell{Wins Total \\ Hours \\ Worked \\ Past Week}"
	label var wins_Owner_Days_Month "\specialcell{Wins Total \\ Days \\ Worked \\ Past Month}"
	label var wins_HH_Labor "\specialcell{Wins Total \\ HH \\ Labor}" 
	label var wins_HH_Labor_Dummy "\specialcell{Wins Uses \\ Household\\ Labor}"
	label var wins_HH_Labor_Hrs "\specialcell{Wins Household\\ Labor \\ Hours \\ Past Week}"
	label var wins_Labor_5 "\specialcell{Wins HH\\ Labor \\ Wage Bill \\ Past Week}"
	label var wins_NonHH_Labor "\specialcell{Wins Total \\ Non-HH \\ Labor}" 
	label var wins_NonHH_Labor_Dummy "\specialcell{Wins Uses \\ Non-HH \\ Labor}" 
	label var wins_NonHH_Labor_Hrs "\specialcell{Wins HH \\ Labor \\ Hours \\ Past Week}"
	label var wins_Labor_10 "\specialcell{Wins Non-HH\\ Labor \\ Wage Bill \\ Past Week}"


	*grant expenditures
	label var grant2 "\specialcell{Rs. Added to \\ Grant Amount}"
	label var Business_Expenditures "\specialcell{Business \\ Expenditures}"
	label var Household_Expenditures "\specialcell{Household \\ Expenditures}"
	label var grant10 "\specialcell{Amt of Grant \\Saved}"
	label var grant3 "\specialcell{Inventory}"
	label var grant4 "\specialcell{Equipment}"
	label var grant5 "\specialcell{Labor}"
	label var grant6 "\specialcell{Other Business \\ Expenditures}"
	label var grant7 "\specialcell{Loan \\ Repayment}"
	label var grant8 "\specialcell{Household \\ Repairs}"
	label var grant9 "\specialcell{Other Household \\ Expenditures}"

	*************************************************	
	*Control Variables
	*************************************************	
	*controls
	label var Gender_Followup "\specialcell{Male}"
	label var Education_Followup "\specialcell{Education}"
	label var Age_Followup "\specialcell{Age}"
	label var Married_Followup "\specialcell{Married}"
	label var  HH_Size_Followup "\specialcell{Household Size}"
	label var B_digitspan_1 "\specialcell{Digitspan}"
	label var  B_Avg_Yrly_Profits "\specialcell{Avg. Monthly Profits}"
	label var B_HH_Assets "\specialcell{Value HH Assets}"
	label var B_child_0to5 "\specialcell{No. Children 0-5}"
	label var B_child_6to12 "\specialcell{No. Children 6-12}"
	label var B_Number_Fixed_Salary "\specialcell{No. Salaried HH Members}"
	label var B_Number_Daily_Wage "\specialcell{No. Daily Wage HH Members}"
	label var  B_Number_Self_Employed "\specialcell{No. Self-Employed HH Members}"
	label var  B_Total_Nu_Bus "\specialcell{Total No. HH Businesses}"
	label var B_Wage_Exit_SE "\specialcell{Wage Exit Self-Employment}"
	label var B_Primary_Job_5yrs "\specialcell{Business Employed in 5 Yrs}"
	label var B_ChangeSales_2014 "\specialcell{Monthly Sales Change 2014}"
	label var B_Psychometric_1 "Impulsiveness I"
	label var B_Psychometric_2 "Impulsiveness II"
	label var B_Psychometric_3 "Impulsiveness III"
	label var B_Psychometric_4 "Optimism I"
	label var B_Psychometric_5 "Tenacity I"
	label var B_Psychometric_6 "Tenacity I"
	label var B_Psychometric_7 "Polychronicity I"
	label var B_Psychometric_8 "Polychronicity II"
	label var B_Psychometric_9 "Optimism II"
	label var B_Psychometric_10 "Polychronicity III"
	label var B_Psychometric_11 "Locus of Control I"
	label var B_Psychometric_12 "Optimism II"
	label var B_Psychometric_13 "Optimism IV"
	label var B_Psychometric_14 "Locus of Control II"
	label var B_Psychometric_15 "Achievement I"
	label var B_Psychometric_16 "Achievement II"
	label var B_Psychometric_17 "Organization"		
	label var B_manufacturing "Manufacturing"
	label var B_retail "Retail"
	label var B_service "Service"
	label var B_agriculture	   "Agriculture"
	*baseline versions of outcomes
	label var B_Profits "\specialcell{Baseline  Profits}"
	label var B_Income "\specialcell{Baseline  Income}"
	label var B_Total_Business_Assets "\specialcell{Baseline Durable Business  Assets}"
	label var B_Inventory "\specialcell{Baseline Business  Inventory}"
	label var B_Capital "\specialcell{Baseline Total  Capital}"
	label var B_Owner_Hours_Week "\specialcell{Baseline Total  Hours  Worked  Past Week}"
	label var B_Owner_Days_Month "\specialcell{Baseline Total  Days  Worked  Past Month}"
	label var B_HH_Labor "\specialcell{Baseline Total  HH  Labor}" 
	label var B_HH_Labor_Dummy "\specialcell{Baseline Uses  Household Labor}"
	label var B_HH_Labor_Hrs "\specialcell{Baseline  Household  Labor  Hours  Past Week}"
	label var B_Labor_5 "\specialcell{Baseline  HH  Labor  Wage Bill  Past Week}"
	label var B_NonHH_Labor "\specialcell{Baseline Total  Non-HH  Labor}" 
	label var B_NonHH_Labor_Dummy "\specialcell{Baseline Uses  Non-HH  Labor}" 
	label var B_NonHH_Labor_Hrs "\specialcell{ Baseline  HH  Labor  Hours  Past Week}"
	label var B_Labor_10 "\specialcell{ Baseline  Non-HH Labor  Wage Bill  Past Week}"
	label var B_TV_hhincome_1 "\specialcell{Baseline Avg Monthly Income in Past Year}"
	*************************************************	
	*Control Variables Interacted with Winner
	*************************************************		
	label var Winner_Gender_Followup "\specialcell{Winner*Male}"
	label var Winner_Education_Followup "\specialcell{Winner*Education}"
	label var Winner_Age_Followup "\specialcell{Winner*Age}"
	label var Winner_Married_Followup "\specialcell{Winner*Married}"
	label var Winner_HH_Size_Followup "\specialcell{Winner*Married}"
	label var Winner_B_digitspan_1 "Winner*Digitspan"
	label var Winner_B_Number_Fixed_Salary "Winner*No. Fixed Salary"
	label var Winner_B_Number_Daily_Wage "Winner*No. Daily Wage"
	label var Winner_B_Number_Self_Employed "Winner*No. Self Employed"
	label var Winner_B_Total_Nu_Bus "Winner*Total No. Businesses"
	label var Winner_B_child_0to5 "Winner*Child 0-5"
	label var Winner_B_child_6to12 "Winner*Child 6-12"
	label var Winner_B_Wage_Exit_SE "\specialcell{Winner*Wage Exit Self-Employment}"
	label var Winner_B_Primary_Job_5yrs "\specialcell{Business Employed in 5 Yrs}"
	label var Winner_B_ChangeSales_2014 "\specialcell{Monthly Sales Change 2014}"
	label var Winner_B_Psychometric_1 "Winner*Impulsiveness I"
	label var Winner_B_Psychometric_2 "Winner*Impulsiveness II"
	label var Winner_B_Psychometric_3 "Winner*Impulsiveness III"
	label var Winner_B_Psychometric_4 "Winner*Optimism I"
	label var Winner_B_Psychometric_5 "Winner*Tenacity I"
	label var Winner_B_Psychometric_6 "Winner*Tenacity I"
	label var Winner_B_Psychometric_7 "Winner*Polychronicity I"
	label var Winner_B_Psychometric_8 "Winner*Polychronicity II"
	label var Winner_B_Psychometric_9 "Winner*Optimism II"
	label var Winner_B_Psychometric_10 "Winner*Polychronicity III"
	label var Winner_B_Psychometric_11 "Winner*Locus of Control I"
	label var Winner_B_Psychometric_12 "Winner*Optimism II"
	label var Winner_B_Psychometric_13 "Winner*Optimism IV"
	label var Winner_B_Psychometric_14 "Winner*Locus of Control II"
	label var Winner_B_Psychometric_15 "Winner*Achievement I"
	label var Winner_B_Psychometric_16 "Winner*Achievement II"
	label var Winner_B_Psychometric_17 "Winner*Organization"
	label var Winner_B_HH_Assets "\specialcell{Winner*Value HH Assets}"
	label var Winner_B_manufacturing "\specialcell{Winner*Manufacturing}"
	label var Winner_B_retail "\specialcell{Winner*Retail}"
	label var Winner_B_service "\specialcell{Winner*Service}"
	label var Winner_B_agriculture	   "\specialcell{Winner*Agriculture}"		
	
	*baseline versions of outcomes
	label var Winner_B_Profits " \specialcell{ Winner*Baseline  Profits}"
	label var Winner_B_Income " \specialcell{ Winner*Baseline  Income}"
	label var Winner_B_Total_Business_Assets " \specialcell{ Winner*Baseline Durable Business  Assets}"
	label var Winner_B_Inventory " \specialcell{ Winner*Baseline Business  Inventory}"
	label var Winner_B_Capital " \specialcell{ Winner*Baseline Total  Capital}"
	label var Winner_B_Owner_Hours_Week " \specialcell{ Winner*Baseline Total  Hours  Worked  Past Week}"
	label var Winner_B_Owner_Days_Month " \specialcell{ Winner*Baseline Total  Days  Worked  Past Month}"
	label var Winner_B_HH_Labor " \specialcell{ Winner*Baseline Total  HH  Labor}" 
	label var Winner_B_HH_Labor_Dummy " \specialcell{ Winner*Baseline Uses  Household\\ Labor}"
	label var Winner_B_HH_Labor_Hrs " \specialcell{ Winner*Baseline  Household  Labor  Hours  Past Week}"
	label var Winner_B_Labor_5 " \specialcell{ Winner*Baseline  HH  Labor  Wage Bill  Past Week}"
	label var Winner_B_NonHH_Labor " \specialcell{ Winner*Baseline Total  Non-HH  Labor}" 
	label var Winner_B_NonHH_Labor_Dummy " \specialcell{ Winner*Baseline Uses  Non-HH  Labor}" 
	label var Winner_B_NonHH_Labor_Hrs " \specialcell{ Winner* Baseline  HH  Labor  Hours  Past Week}"
	label var Winner_B_Labor_10 " \specialcell{ Winner* Baseline  Non-HH Labor  Wage Bill  Past Week}"
	label var Winner_B_TV_hhincome_1 "\specialcell{Winner*Baseline Avg Monthly Income in Past Year}"
	label var Winner_B_Avg_Yrly_Profits  "\specialcell{Winner*Baseline Avg Monthly Profits in Past Year}"
	*************************************************	
	*WInner* RANK
	*************************************************		
	label var Quint_Rank_NS_Tercile_3 "\specialcell{\enspace Top Tercile Rank}"
	label var 	Quint_Rank_NS_Tercile_2 "\specialcell{\enspace Middle Tercile Rank}"
	label var Quint_Rank_NS "\specialcell{\enspace Rank}"
	
	label var Winner_Quint_Rank_NS_Tercile_3 "\specialcell{\enspace  Winner*Top Tercile Rank}"
	label var 	Winner_Quint_Rank_NS_Tercile_2 "\specialcell{\enspace  Winner*Middle Tercile Rank}"
	label var Winner_Quint_Rank_NS "\specialcell{\enspace Winner*Rank}"

	label var Rel_Rank_NS_Tercile_3 "\specialcell{\enspace Top Tercile Relative Rank}"
	label var 	Rel_Rank_NS_Tercile_2 "\specialcell{\enspace Middle Tercile Relative Rank}"
	label var Rel_Rank_NS "\specialcell{\enspace MR Relative Rank}"
	
	label var Winner_Rel_Rank_NS_Tercile_3 "\specialcell{\enspace  Winner*Top Tercile Relative  Rank}"
	label var 	Winner_Rel_Rank_NS_Tercile_2 "\specialcell{\enspace  Winner*Middle Tercile Relative Rank}"
	label var Winner_Rel_Rank_NS "\specialcell{\enspace Winner*Relative Rank}"
	
	label var Winner_Quintile_Rank_Tercile_3 "\specialcell{Winner*Top Tercile Rank}"
	label var 	Winner_Quintile_Rank_Tercile_2 "\specialcell{Winner*Middle Tercile Rank}"
	label var Winner_Relative_Rank_Tercile_3 "\specialcell{Winner*Top Tercile Relative Rank}"
	label var 	Winner_Relative_Rank_Tercile_2 "\specialcell{Winner*Middle Tercile Relative Rank}"
	label var Winner_Quintile_Rank "\specialcell{Winner*Rank}"
	label var Winner_Relative_Rank "\specialcell{Winner*Relative Rank}"
	
	label var 	Winner_SD_Rank "\specialcell{\enspace  Winner*Std Rank}"
	label var 	Winner_Quint_Rank_sd_NS "\specialcell{\enspace  Winner*Std Rank*Rank}"
	label var Winner_T3_sd_NS "\specialcell{\enspace  Winner*Top Tercile Rank*Std Rank}"
	label var Winner_T2_sd_NS "\specialcell{\enspace  Winner*Middle Tercile Rank*Std Rank}"
	
	
	label var Winner_Q_Rank_med_NS_Tercile_3 "\specialcell{\enspace  Winner*Top Tercile Median  Rank}"
	label var 	Winner_Q_Rank_med_NS_Tercile_2 "\specialcell{\enspace  Winner*Middle Tercile Median Rank}"
	label var Winner_Q_Rank_med_NS "\specialcell{\enspace Winner*Median Rank}"	
		
	label var Quintile_Rank_Tercile_3 "\specialcell{Top Tercile Rank}"
	label var 	Quintile_Rank_Tercile_2 "\specialcell{Middle Tercile Rank}"
	label var 	Quintile_Rank "\specialcell{Rank}"
	
	label var Winner "\specialcell{\enspace Winner}" 
	

******************************************************************************************************************************************************
*SAVING
*******************************************************************************************************************************************************

	drop __*
	
	sort Id  Survey_Version
	
	local nosave : list sizeof global(notsave)
	display "`round5'"
	if ( `nosave'==0) {
		save "$data_final/Panel HH Level with Variables.dta", replace
	}